#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>

int main()
{
    close(1);
    int fd = open("test.txt", O_CREAT | O_WRONLY | O_TRUNC, 0666);

    if(fd == 1)
        printf("喜欢stdout的小朋友你们好啊！我是test.txt，stdout已经被我干掉了！\n");
    fprintf(stdout, "fd: %d\n", fd);

    return 0;
}
